<template>
  <div class="more-action">
    <!-- 状态一 -->
    <van-cell-group v-if="!isReport">
      <van-cell @click="hUnlike">不感兴趣</van-cell>
      <van-cell is-link @click="isReport = true">反馈垃圾内容</van-cell>
      <van-cell>拉黑作者</van-cell>
    </van-cell-group>
    <!-- 状态二 反馈-->
    <van-cell-group v-else>
      <van-cell icon="arrow-left" @click="isReport = false">返回</van-cell>
      <van-cell
        v-for="report in reports"
        :key="report.value"
        @click="hReport('report.value')"
        >{{ report.label }}</van-cell
      >
      <!-- <van-cell>色情</van-cell>
      <van-cell>暴力</van-cell>
      <van-cell>低俗</van-cell>
      <van-cell>不适</van-cell>
      <van-cell>错误</van-cell>
      <van-cell>其他</van-cell> -->
    </van-cell-group>
  </div>
</template>
<script>
// 引入提前定义好的常量数据
import reports from '@/constant/reports'
export default {
  name: 'MoreAction',
  data () {
    return {
      reports,
      isReport: false // 是否显示举报
    }
  },
  methods: {
    hUnlike () {
      this.$emit('un-like')
    },
    hReport (typeId) {
      // 子传父：
      // this.$emit('事件名', 实参)
      this.$emit('report', typeId)
    }
  }
}
</script>
